home *** CD-ROM | disk | FTP | other *** search
- *** /home/bammi/etc/src/patch/common.h Thu Mar 19 18:34:17 1992
- --- common.h Fri Mar 20 18:30:38 1992
- ***************
- *** 54,64 ****
- --- 54,70 ----
- #define MAXHUNKSIZE 100000 /* is this enough lines? */
- #define INITHUNKMAX 125 /* initial dynamic allocation size */
- #define MAXLINELEN 1024
- +
- + #ifndef atarist
- #define BUFFERSIZE 1024
- #define SCCSPREFIX "s."
- #define GET "get -e %s"
- #define RCSSUFFIX ",v"
- #define CHECKOUT "co -l %s"
- + #else
- + extern unsigned long __DEFAULT_BUFSIZ__;
- + #define BUFFERSIZE __DEFAULT_BUFSIZ__
- + #endif
-
- #ifdef FLEXFILENAMES
- #define ORIGEXT ".orig"
- ***************
- *** 86,92 ****
- --- 92,103 ----
-
- typedef char bool;
- typedef long LINENUM; /* must be signed */
- + #ifndef atarist
- typedef unsigned MEM; /* what to feed malloc */
- + #else
- + #include <stddef.h>
- + typedef size_t MEM; /* what to feed malloc */
- + #endif
-
- /* globals */
-
- ***************
- *** 98,104 ****
- --- 109,119 ----
- EXT struct stat filestat; /* file statistics area */
- EXT int filemode INIT(0644);
-
- + #ifndef atarist
- EXT char buf[MAXLINELEN]; /* general purpose buffer */
- + #else
- + EXT char buf[32768]; /* general purpose buffer */
- + #endif
- EXT FILE *ofp INIT(Nullfp); /* output file pointer */
- EXT FILE *rejfp INIT(Nullfp); /* reject file pointer */
-
- ***************
- *** 151,156 ****
- --- 166,176 ----
-
- EXT char *revision INIT(Nullch); /* prerequisite revision, if any */
-
- + #ifdef NODIR
- + EXT char *simple_backup_suffix INIT("~");
- + #endif
- +
- + #ifndef atarist
- char *malloc();
- char *realloc();
- char *strcpy();
- ***************
- *** 158,163 ****
- --- 178,191 ----
- long atol();
- long lseek();
- char *mktemp();
- + char *getenv();
- + #else
- + #include <string.h>
- + #include <memory.h>
- + #include <unistd.h>
- + EXT unsigned long __DEFAULT_BUFSIZ__ INIT(64*1024L);
- + #endif
- +
- #if 0
- #ifdef CHARSPRINTF
- char *sprintf();
- ***************
- *** 165,168 ****
- int sprintf();
- #endif
- #endif
- - char *getenv();
- --- 193,195 ----
- *** /home/bammi/etc/src/patch/inp.c Sun Jan 20 20:12:22 1991
- --- inp.c Fri Mar 20 18:30:41 1992
- ***************
- *** 87,92 ****
- --- 87,93 ----
- close(creat(filename, 0666));
- }
- if (stat(filename, &filestat) < 0) {
- + #ifndef atarist
- Sprintf(buf, "RCS/%s%s", filename, RCSSUFFIX);
- if (stat(buf, &filestat) >= 0 || stat(buf+4, &filestat) >= 0) {
- Sprintf(buf, CHECKOUT, filename);
- ***************
- *** 110,115 ****
- --- 111,119 ----
- else
- fatal2("Can't find %s.\n", filename);
- }
- + #else
- + fatal2("Can't find %s.\n", filename);
- + #endif
- }
- filemode = filestat.st_mode;
- if ((filemode & S_IFMT) & ~S_IFREG)
- *** /home/bammi/etc/src/patch/patch.c Thu Mar 19 18:34:18 1992
- --- patch.c Fri Mar 20 18:30:44 1992
- ***************
- *** 137,146 ****
- --- 137,151 ----
- int failtotal = 0;
- int i;
-
- + #ifdef atarist
- + _binmode(1);
- + stdin->_flag |= _IOBIN; /* sorry! */
- + #endif
- setbuf(stderr, serrbuf);
- for (i = 0; i<MAXFILEC; i++)
- filearg[i] = Nullch;
-
- + #ifndef atarist
- /* Cons up the names of the temporary files. */
- {
- /* Directory for temporary files. */
- ***************
- *** 173,178 ****
- --- 178,218 ----
- strcat (TMPPATNAME, "/patchpXXXXXX");
- Mktemp(TMPPATNAME);
- }
- + #else
- + /* Cons up the names of the temporary files. */
- + {
- + /* Directory for temporary files. */
- + char *tmpdir;
- + size_t tmpname_len;
- +
- + if(!(tmpdir = getenv("TEMP")))
- + tmpdir = getenv ("TMPDIR");
- + if (tmpdir == NULL) {
- + tmpdir = ".";
- + }
- + tmpname_len = strlen (tmpdir) + 20;
- +
- + TMPOUTNAME = (char *) malloc (tmpname_len);
- + strcpy (TMPOUTNAME, tmpdir);
- + strcat (TMPOUTNAME, "/poXXXXXX");
- + Mktemp(TMPOUTNAME);
- +
- + TMPINNAME = (char *) malloc (tmpname_len);
- + strcpy (TMPINNAME, tmpdir);
- + strcat (TMPINNAME, "/piXXXXXX");
- + Mktemp(TMPINNAME);
- +
- + TMPREJNAME = (char *) malloc (tmpname_len);
- + strcpy (TMPREJNAME, tmpdir);
- + strcat (TMPREJNAME, "/prXXXXXX");
- + Mktemp(TMPREJNAME);
- +
- + TMPPATNAME = (char *) malloc (tmpname_len);
- + strcpy (TMPPATNAME, tmpdir);
- + strcat (TMPPATNAME, "/ppXXXXXX");
- + Mktemp(TMPPATNAME);
- + }
- + #endif
-
- /* parse switches */
- Argc = argc;
- *** /home/bammi/etc/src/patch/pch.c Tue Dec 3 11:27:06 1991
- --- pch.c Fri Mar 20 18:30:47 1992
- ***************
- *** 728,738 ****
- --- 728,741 ----
-
- if (diff_type == CONTEXT_DIFF &&
- (fillcnt || (p_first > 1 && ptrn_copiable > 2*p_context)) ) {
- + #ifndef atarist /* unfortunately this is always true for TOS because of
- + the ^M at the end of a line -- just ignore warning */
- if (verbose)
- say4("%s\n%s\n%s\n",
- "(Fascinating--this is really a new-style context diff but without",
- "the telltale extra asterisks on the *** line that usually indicate",
- "the new style...)");
- + #endif
- diff_type = NEW_CONTEXT_DIFF;
- }
-
- ***************
- *** 1239,1244 ****
- --- 1242,1248 ----
- return p_hunk_beg;
- }
-
- + #ifndef atarist
- /* Apply an ed script by feeding ed itself. */
-
- void
- ***************
- *** 1302,1304 ****
- --- 1306,1316 ----
- chmod(outname, filemode);
- set_signals(1);
- }
- + #else
- + void
- + do_ed_script()
- + {
- + fprintf(stderr,"Sorry! TOS version of Patch cannot deal with ed scripts\n");
- + exit(999);
- + }
- + #endif
- No differences encountered
- *** /home/bammi/etc/src/patch/util.c Thu Mar 19 18:34:20 1992
- --- util.c Fri Mar 20 18:30:49 1992
- ***************
- *** 74,84 ****
- --- 74,88 ----
- if (debug & 4)
- say3("Moving %s to %s.\n", to, bakname);
- #endif
- + #ifdef atarist
- + copy_file(to, bakname);
- + #else
- if (link(to, bakname) < 0) {
- say3("patch: can't backup %s, output is in %s\n",
- to, from);
- return -1;
- }
- + #endif
- while (unlink(to) >= 0) ;
- }
- #ifdef DEBUGGING
- ***************
- *** 85,91 ****
- --- 89,100 ----
- if (debug & 4)
- say3("Moving %s to %s.\n", from, to);
- #endif
- +
- + #ifndef atarist
- if (link(from, to) < 0) { /* different file system? */
- + #else
- + if (1) {
- + #endif
- Reg4 int tofd;
-
- tofd = creat(to, 0666);
- ***************
- *** 205,210 ****
- --- 214,222 ----
-
- Sprintf(buf, pat, arg1, arg2, arg3);
- Fflush(stderr);
- + #ifdef atarist
- + r = _tos_ask(buf);
- + #else
- write(2, buf, strlen(buf));
- if (tty2) { /* might be redirected to a file */
- r = read(2, buf, sizeof buf);
- ***************
- *** 229,234 ****
- --- 241,247 ----
- buf[0] = '\n';
- r = 1;
- }
- + #endif
- if (r <= 0)
- buf[0] = 0;
- else
- ***************
- *** 364,369 ****
- --- 377,383 ----
- Sprintf(tmpbuf, "RCS/%s", name);
- free(s);
- if (stat(name, &filestat) < 0 && !assume_exists) {
- + #ifndef atarist
- Strcat(tmpbuf, RCSSUFFIX);
- if (stat(tmpbuf, &filestat) < 0 && stat(tmpbuf+4, &filestat) < 0) {
- Sprintf(tmpbuf, "SCCS/%s%s", SCCSPREFIX, name);
- ***************
- *** 372,377 ****
- --- 386,441 ----
- name = Nullch;
- }
- }
- + #else
- + free(name);
- + name = Nullch;
- + #endif
- }
- return name;
- }
- +
- + /* this kludge is necessary because stdin is most likely re-directed
- + and there is no way to read from CON: due to the braindamage
- + in handles -- thanks Atari
- + */
- + #ifdef atarist
- + #undef Fclose
- + #undef Fseek
- + #include <osbind.h>
- + int _tos_ask(buf)
- + char *buf;
- + {
- + /* have to el-kludge it */
- + int c;
- + int r = 0;
- + char *p = buf;
- +
- + write(2, buf, strlen(buf));
- +
- + while(( c = (Bconin(2) & 0x7f)) != '\r')
- + {
- + switch(c)
- + { /* we dont handle tabs/control chars nicely here */
- + case 0:
- + break;
- + case '\b':
- + case 0177:
- + if(r > 0)
- + { --p; --r; }
- + Bconout(2, '\b'); Bconout(2, ' '); Bconout(2, '\b');
- + break;
- + default:
- + if(c >= ' ')
- + {
- + *p++ = c; r++;
- + Bconout(2, c);
- + }
- + /* else ignore control chars/tabs */
- + }
- + }
- + Bconout(2, '\r');
- + Bconout(2, '\n');
- + *p++ = '\n'; *p = '\0';
- + return r+1;
- + }
- + #endif
-